package com.broada.apm.utils;

import org.slf4j.Logger;

public class ExceptionUtils {
	public static void error(Logger logger, String info , Throwable e) {
		error(logger,info, e, null);
	}
	public static void error(Logger logger, String info , Throwable e, Object data) {
		String errorNo = Long.toHexString(System.currentTimeMillis());
		logger.error(info + " : #" + errorNo + " " + (e == null ? "" : e) );
		if(data != null) {
			logger.error( "数据 : #" + errorNo +" " + data);
		}
		if(e != null) {
		    logger.error("堆栈：#" + errorNo ,e);
		}
	}
	public static void warn(Logger logger, String info , Throwable e) {
		String errorNo = Long.toHexString(System.currentTimeMillis());
		logger.warn(info + " : #" + errorNo +" " + e);
		logger.debug("堆栈：#" + errorNo ,e);
	}
}
